{template 'common/header'}

<title>个人中心</title>
<style>
    .header-box{
        position: absolute;
        width: 100%;
        top: 0;
        height: 25%;
    }
    #main-box{
        position: absolute;
        width: 100%;
        top: 25%;
        height: 75% !important;
        overflow: auto;
    }
    #info-bar{
        position: absolute;
        width: 100%;
        bottom: 0;
    }
    .border-b-no{
        border-bottom: 0px;
    }
    #user-name{
        display: block;
        max-width: 50%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .user-box{
        max-width: 72%;
    }
</style>
<div class="xhq_body body_bg6">
    <div id="container" style="height:100%;">

        <div class="header-box">
            <div class="container-fluid vip-info-bg" id="info-box">
                <div class="user-head-pic pull-left margin-sm img-circle" style="overflow: hidden">
                    <img src="{$member['avatar']}" alt="" class="img-responsive " style="height: 100%">
                </div>
                <div class="container-fluid pull-left margin-sm user-box">
                    <ul class="list-unstyled vip-info-list">
                        <li><h6 class="pull-left">昵称：</h6><h6 id="user-name" class="pull-left">{$member['nickname']}</h6><h6 class="pull-left" style="margin-left: 10px"><a class="blue_font" href="{php echo $this->createMobileUrl('member/info')}">账号设置</a></h6></li>
                        <li><h6 class="pull-left">花名：</h6><h6 class="pull-left">{$member['commission']['levelname']}</h6></li>
                        <li><h6 class="pull-left">编号：</h6><h6 class="pull-left">{$member['id']}</h6></li>
                    </ul>
                </div>
            </div>
            <div class="container-fluid amount_detail_banner" id="info-bar">
                <div class="row">
                    <div class="col-xs-6 pull-left">
                        <div class="row border-right">
                            <h5 class="text-center white_font">我的订单 : {if !empty($price)}{$price}{else}0{/if}元</h5>
                        </div>
                    </div>
                    <div class="col-xs-6 pull-left">
                        <div class="row">
                            <h5 class="text-center white_font">余额 : {$member['credit2']}元</h5>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="main-box" id="main-box" >
            <div class="container-fluid" id="vip_cont_box" >
                <div class="row">
                    <div class="container-fluid white-bg margin-sm">
                        <ul class="list-unstyled vip-center-list">
                        {if $member['agentid'] != 0}
                            <li class="padding-sm" style="text-align: center;">
                                <span class="col-xs-12">您是由【{$superior['nickname']}】推荐</span>
                            </li>
                        {else}
                            <li class="padding-sm" style="text-align: center;">
                                <span class="col-xs-12">您是由【{$set['shop']['name']}】推荐</span>
                            </li>
                        {/if}
                        </ul>
                    </div>
                    <div class="container-fluid white-bg margin-sm">
                        <div class="container-fluid no-padding">
                            <button class="text-left btn btn-block white-bg border-grey" type="button" onclick="">
                                <span class="glyphicon glyphicon-triangle-bottom pull-left margin-r-xs"></span>{$commissionSet['texts']['myteam']}<span class="badge pull-right">{php echo $teamLists['all']}人</span>
                            </button>
                        </div>
                    </div>
                    <div class="container-fluid white-bg margin-sm">
                        <div class="container-fluid no-padding">
                            <a style="margin-top:0px;text-align: left;" class="btn white-bg col-xs-12 h4 border-grey" href="{php echo $this->createMobileUrl('order/list')}">我的订单</a>
                        </div>
                    </div>

                    <div class="container-fluid white-bg margin-sm">
                        <div class="container-fluid no-padding">
                            <button class="text-left btn btn-block white-bg border-grey" type="button" onclick="">
                                <span class="glyphicon glyphicon-triangle-bottom pull-left margin-r-xs"></span>我的余额 &nbsp;<a href="{php echo $this->createMobileUrl('member/recharge',array('openid'=>$openid))}"><span class="list1" style="border-bottom: 0px;">充值</span></a><span class="badge pull-right">{$member['credit2']}元</span>
                            </button>
                        </div>
                    </div>
                    {if isset($set['trade']) && $set['trade']['withdraw']==1}
                    <div class="container-fluid white-bg margin-sm">
                        <div class="container-fluid no-padding">
                            <button class="text-left btn btn-block white-bg border-grey" type="button"  id="btnwithdrawYue">
                                <span class="glyphicon glyphicon-triangle-bottom pull-left margin-r-xs"></span>余额提现<i class="fa fa-angle-right" style="color:#999; font-size:20px; float:right; "></i></span>
                            </button>
                        </div>
                    </div>
                    {/if}

                    <div class="container-fluid white-bg margin-sm">
                        <div class="container-fluid no-padding">
                            <a style="margin-top:0px;" class="btn white-bg col-xs-12 h4 border-grey" id="btnwithdrawList" href="{php echo $this->createMobileUrl('member/log',array('type'=>1))}">提现记录</a>
                        </div>
                    </div>

                    <div style="height:46px;"></div>

                </div>
            </div>
        </div>
    </div>

    <script type="text/html" id="tpl_show_message"></script>

    <script language="javascript">
        require(['tpl', 'core'], function(tpl, core) {
            $(function(){
                $('#btnwithdraw').click(function(){
                    var mine = parseInt("{$recordPrice['ok']}");
                    var withdraw = parseInt("{php echo $commissionSet['withdraw']}");
                    if(mine > 0){
                        if(mine < withdraw){
                            core.tip.show('提现申请请在每周一发起。');
                            return false;
                        }else{
                            location.href = "{php echo $this->createPluginMobileUrl('commission/apply')}";
                        }
                    }else{
                        core.tip.show('很抱歉，没有可以提现的佣金');
                    }
                });
                var withdrawmoney = {php echo empty($set['trade']['withdrawmoney'])?0:floatval($set['trade']['withdrawmoney'])};
                $('#btnwithdrawYue').click(function(){
                    if(json.result.member.credit2<=0){
                        core.tip.show('无余额可提!');
                        return;
                    }
                    if(withdrawmoney>0 && json.result.member.credit2<withdrawmoney){
                        core.tip.show('满' +withdrawmoney + "元才能提现!" );
                        return;
                    }
                    location.href = core.getUrl('member/withdraw');
                });
            });
        });
    </script>
    <script>
        function show_detail(e){
            $(e).next('.collapse').toggle();
        }
    </script>
    {php $show_footer=true}
    {php $footer_current='member'}
    {template 'common/footer'}